﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ADDDF.Infrastructure.Collections
{
    /// <summary>
    /// IEntityValueSet is an interface for a set data-structure containing entities
    /// in the form of IEntity interface. It supports common operations to find, and
    /// manipulate items in the set. Each operation in IEntitySet has a corresponding
    /// operation in IEntityValueSet with the suffix "V" which indicates that the entities
    /// are passed "by-value". 
    /// </summary>
    public interface IEntityValueSet : IEntitySet
    {
        void FindByKeyV(object key, out IEntity result);

        void GetAllV(out IEnumerable<IEntity> result);

        bool AddAndReplaceV(IEntity item);

        bool Remove(IEntity item);

        void RemoveAll();

        int Count();

        void SubtractV(IEntitySet another, out IEnumerable<IEntity> result);

        void IntersectV(IEntitySet another, out IEnumerable<IEntity> result);     
    }

    /// <summary>
    /// IEntityValueSet is an interface for a set data-structure containing entities
    /// in the form of IEntity interface. It supports common operations to find, and
    /// manipulate items in the set. Each operation in IEntitySet has a corresponding
    /// operation in IEntityValueSet with the suffix "V" which indicates that the entities
    /// are passed "by-value". 
    /// </summary>
    public interface IEntityValueSet<T> : IEntityValueSet, IEntitySet<T>
        where T: IEntity
    {
        T FindByKeyV(object key);

        IEnumerable<T> GetAllV();

        bool AddAndReplaceV(T item);

        bool Remove(T item);

        void RemoveAll();

        int Count();

        IEnumerable<T> SubtractV(IEntitySet<T> another);

        IEnumerable<T> IntersectV(IEntitySet<T> another);
    }
}
